// import faker from 'faker';
import { faker } from '@faker-js/faker';
import { generateSongs, Song } from '../songs/ranking-songs';
import { IUserArtist } from '../user/user';
import { generateUserArtist } from '../user/user';
// 定义 Album 接口
export interface Album {
    id: number;
    name: string;
    picUrl: string;
    bio: string | "";
    songs: Song[];
    artist: IUserArtist;
}

// 生成单个 Album 的模拟数据
export async function generateAlbum(): Promise<Album> {
    const songs = await generateSongs(faker.number.int({ min: 1, max: 10 }));
    return {
        id: faker.number.int({ min: 1, max: 10000 }),
        name: faker.music.songName().slice(0, 10),
        picUrl: faker.image.url(),
        bio: faker.lorem.paragraph(),
        songs: songs,
        artist: await generateUserArtist()
    };
}

export async function generateAlbumWithStaticId(id: number): Promise<Album> {
    const songs = await generateSongs(faker.number.int({ min: 1, max: 10 }));
    return {
        id: id,
        name: faker.music.songName().slice(0, 10),
        picUrl: faker.image.url(),
        bio: faker.lorem.paragraph(),
        songs: songs,
        artist: await generateUserArtist()
    };
}

// 生成多个 Album 的模拟数据
export async function generateAlbums(count:number = 5): Promise<Album[]> {
    const albums: Album[] = [];
    for (let i = 0; i < count; i++) {
        albums.push(await generateAlbum());
    }
    return albums;
}

// 示例：生成 10 个 Album 的模拟数据
export const mockAlbums = generateAlbums(10);
